package com.wesleyone.sc.controller;

import com.wesleyone.sc.entities.CommonResult;
import com.wesleyone.sc.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.wesleyone.sc.service.PaymentFeignService;

import javax.annotation.Resource;

/**
 * @Author: wesleyOne
 * @Email: wesleyone666@163.com
 * @Gitee: https://gitee.com/wesleyOne
 * @Date: 2020/8/26
 */
@RestController
@Slf4j
public class OrderController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPayment(@PathVariable("id")Long id) {
        return paymentFeignService.getById(id);
    }

    @GetMapping(value = "/consumer/payment/feign/timeout")
    public String paymentTimeout() {
        // openfeign默认超时1s
        return paymentFeignService.paymentTimeout();
    }
}
